home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Gigarom 1
/
Gigarom Macintosh Archives (Quantum Leap)(CDRM1080320)(1993).iso
/
FILES
/
HYP
/
C-D
/
DeveloperStax.cpt
/
Developer Stack 1.0
/
card_6668.txt
< prev
next >
Wrap
Text File
|
1989-02-26
|
4KB
|
155 lines
-- card: 6668 from stack: in.0
-- bmap block id: 0
-- flags: 0000
-- background id: 3837
-- name: PopUpMenu
----- HyperTalk script -----
on closecard
hide message window
end closecard
-- part 1 (button)
-- low flags: 00
-- high flags: A004
-- rect: left=227 top=32 right=51 bottom=288
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 1
-- font id: 0
-- text size: 12
-- style flags: 0
-- line height: 16
-- part name: Example
----- HyperTalk script -----
on mousedown
if the optionkey is down then
edit script of target
exit mousedown
end if
put the mouseloc into myPlace
put item 1 of myPlace - 20 into horiz
put item 2 of myPlace - 10 into vert
get PopUpMenu("Hello;my;name;is;Steve", 1, vert, horiz)
put "You chose item" && it
end mousedown
-- part 2 (button)
-- low flags: 00
-- high flags: A004
-- rect: left=299 top=32 right=51 bottom=360
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 1
-- font id: 0
-- text size: 12
-- style flags: 0
-- line height: 16
-- part name: Another
----- HyperTalk script -----
on mousedown
if the optionkey is down then
edit script of target
exit mousedown
end if
put the mouseloc into myPlace
put item 1 of myPlace - 20 into horiz
put item 2 of myPlace - 10 into vert
get PopUpMenu("For;a;disk;catalog;of;BMUG's;stack;library;"& "Send;$3;To;BMUG;1442A;Walnut;#62;Berkeley;CA;94709", 5, vert, horiz)
put "You chose item" && it
end mousedown
-- part 3 (button)
-- low flags: 00
-- high flags: A003
-- rect: left=82 top=302 right=324 bottom=182
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 1
-- font id: 0
-- text size: 12
-- style flags: 0
-- line height: 16
-- part name: Install
----- HyperTalk script -----
on mouseUp
if the optionkey is down then
pass mouseup
end if
put (long name of this stack) into sourceStack
delete first word of sourceStack
delete first character of sourceStack
delete last character of sourceStack
put "Select a stack to copy this resource into."
put filename("STAK") into fname
if fname is empty then
hide message window
exit mouseup
end if
if sourcestack=fname then
beep
Answer "Get real. You can't install it in this stack"
hide message window
exit mouseup
end if
--
ModResCopy sourceStack,fname,"XFCN","PopUpMenu"
--
get the result
if first char of it is "E" then
put it into the message box
beep
answer "Attempt to install resource has failed."
else
beep
answer "Resource installation successful"
end if
hide message window
end mouseUp
-- part contents for background part 10
----- text -----
3
-- part contents for background part 5
----- text -----
PopUpMenu
-- part contents for background part 6
----- text -----
This HyperCard external function returns the selection from a popup menu created from a hypercard item list (the first parameter). The
menu is placed on the screen so that the checked item is at the position (global) top,left.
Thanks to:
Andrew Gilmartin
Brown University
-- part contents for background part 7
----- text -----
Syntax:
PopUpMenu( "MenuItems", CheckedItem, Top, Left )
"MenuItems" is a list of items seperated by commas that will comprise the menu.
<CheckedItem> is the number of the item that will be initially selected & checked.
<Top> is the vertical placement of the checked item.
<Left> is the horizontal placement of the checked item.